<?php

include_once ("video.php");
class videoPlayer {

	private $video;

	//Size parameters
	private $bigWidth;
	private $bigHeight;
	private $smallWidth;
	private $smallHeight;

	public function __construct($video) {

		//set the variables
		$this -> video = $video;
		$this -> bigWidth = 640;
		$this -> bigHeight = 360;
		$this -> smallHeight = 640;
		$this -> smallWidth = 360;

	}

	public function displayAll() {
		echo '<article>';
		$this -> displayVideo();
		$this -> video -> displaySlides();
		echo'<div id="videoAddOn">';
		$this -> video -> displaySlidesPins();
		$this -> displayTimeBar();
		$this -> video -> displayAnnotationsPins();
		$this -> displayButtons();
		echo '</div>';
		echo '</article>';
		$this -> video -> displayAnnotationsList($this->video->getIdVideo());

	}

	//Display the video player with the selected video with the custom timebar.
	public function displayVideo() {

		echo '<div id="videoPlayer">';
		echo '<video id="video" width="' . $this -> bigWidth . '" height="' . $this -> bigHeight . '" preload="auto" onloadedmetadata="initProgressBar()">';

		$this -> video -> sourcesVideo();

		echo 'Your browser does not support the video tag.</video>';

		 echo '</div>';

	}
	
	public function displayVideoSimple() {

		echo '<video id="video" width="' . $this -> bigWidth . '" height="' . $this -> bigHeight . '" preload="auto" controls>';
		$this -> video -> sourcesVideo();
		echo 'Your browser does not support the video tag.</video>';

	}

	public function displayTimeBar() {
		//Time bar
		echo '<div id="timeBar"><div id="slider"></div><div id="videoTime"></div></div>';

	}

	public function displayButtons() {
		//Buttons play/pause, switch video,
		echo '<div id="videoButtons">';
		echo '<button onclick="playPause()">Play/Pause</button>';
		echo ' <button onclick="switchVideos()">Switch Videos</button>';
		echo '</div>';
	}

	public function getVideo() {
		return $this -> video;
	}

}
?>
